import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import vuetify from './plugins/vuetify';
import {_get, _delete, _post, _put} from "./network";
import Toasted from 'vue-toasted';
import VuePlyr from 'vue-plyr'
import "./assets/css/font.css"

Vue.config.productionTip = false

// 请求方法
Vue.prototype._get = _get;
Vue.prototype._delete = _delete;
Vue.prototype._post = _post;
Vue.prototype._put = _put;

// 提示
Vue.use(Toasted, {
    iconPack: 'mdi',
    duration: 2000,
    position: "top-center",
    theme: "outline",
    keepOnHover: true
});

Vue.toasted.register('success', (payload) => payload.message, {
    type : 'success',
    icon : 'mdi-check'
})
Vue.prototype.$success = Vue.toasted.global.success

Vue.toasted.register('error', (payload) => payload.message, {
    type : 'error',
    icon : 'mdi-close'
})
Vue.prototype.$error = Vue.toasted.global.error

Vue.toasted.register('serverError', '服务器繁忙', {
    type : 'error',
    icon : 'mdi-close'
})
Vue.prototype.$serverError = Vue.toasted.global.error

// 播放器
Vue.use(VuePlyr, {
    plyr: {
        speed: {
            selected: 1,
            options: [0.5, 1, 1.5, 2]
        },
        invertTime: false,
        ratio: '16:9',
        controls: [
            'play-large',
            'restart',
            'rewind',
            'play',
            'fast-forward',
            'progress',
            'current-time',
            'duration',
            'mute',
            'volume',
            'settings',
            'pip',
            'airplay',
            'fullscreen'
        ],
        settings: ['speed'],
        i18n: {
            restart: '重新播放',
            play: '播放',
            pause: '暂停',
            duration: '时长',
            volume: '音量',
            mute: '静音',
            unmute: '取消静音',
            download: '下载',
            settings: '设置',
            pip: '画中画',
            speed: '速度',
            normal: '正常',
            quality: '清晰度',
            loop: '循环',
            start: '开始',
            reset: '重置',
            disabled: '关闭',
            enabled: '开启'
        }
    },
    emit: ['ended']
})

new Vue({
    router,
    store,
    vuetify,
    render: h => h(App)
}).$mount('#app')
